package com.example.pufang.controller.front;

import com.example.common.CommonResult;
import com.example.pufang.pojo.ImgModel;
import com.example.pufang.service.ImgModelService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/front/imgModel")
@CrossOrigin
@Api(tags = "h5房屋接口")
public class ImgModelFrontController {

    @Autowired
    private ImgModelService imgModelService;

    @Operation(summary = "获取首页轮播图url")
    @GetMapping("indexSwiper")
    public CommonResult<Map<String, Object>> getFrontIndexSwiper() {
        String type = "h5_index_swiper";
        Map<String, Object> map = imgModelService.getListByType(type);
        if (map.isEmpty()) {
            return CommonResult.failed("获取失败");
        } else {
            return CommonResult.success(map);
        }
    }

}
